def read_test():
    file = open("d.txt", "w+")
    file.write("你好abc")

    # 读取所有的字符
    file.seek(0)
    s = file.read()
    print(s)
    # 读取3个字符
    file.seek(0)
    s = file.read(3)
    print(s)
    # 读取一行文字
    file.seek(0)
    s = file.readline()
    print(s)
    # 读取一行文字list
    file.seek(7)
    s = file.readlines()
    print(s)

    # 关闭
    file.close()


if __name__ == '__main__':
    read_test()
